package com.eliaukjq.jihe;

/**
 * @Author : 佩萁
 * Description :
 * @Create : 2024/7/13 - 17:20
 */
public class Main {
    public static void main(String[] args) {
        Animal myDog = new Dog();
        Animal myCat = new Cat();

        if (myDog instanceof Dog) {
            System.out.println("myDog is a Dog");
        }

        if (myCat instanceof Dog) {
            System.out.println("myCat is a Dog");
        } else {
            System.out.println("myCat is not a Dog");
        }

        if (myDog instanceof Animal) {
            System.out.println("myDog is an Animal");
        }
    }
}

class Animal {
}

class Dog extends Animal {
}

class Cat extends Animal {
}